package com.new2i.dao.mapper;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.new2i.model.DoctorUserEntity;

/**
 * DoctorUser类的sql 接口
 * 
 * @since 2015/09/03
 * @author 2i
 *
 */
public interface DoctorUserMapper {

	/**
	 * 医生的所有用户
	 * 
	 * @author 2i
	 * @since 2015/09/03
	 * @return
	 */
	List<HashMap<String, Object>> selectUserList(@Param("doctor_id") final int doctor_id,
			@Param("keyword") final String keyword, @Param("du_group_id") final int du_group_id,
			@Param("start") final int start, @Param("offset") final int offset);

	/**
	 * 医生用户数目
	 * 
	 * @author 2i
	 * @since 2015/09/03
	 * @param doctor_id
	 * @param user_name
	 * @param du_group_id
	 * @return
	 */
	HashMap<String, Object> getUserCount(@Param("doctor_id") final int doctor_id,
			@Param("keyword") final String keyword, @Param("du_group_id") final int du_group_id);
	

	/**
	 * 医生所有用户的数目
	 * 
	 * @author 2i
	 * @since 2015/09/03
	 * @param doctor_id
	 * @return
	 */
	HashMap<String, Object> getTotalUserCount(@Param("doctor_id") final int doctor_id);
	

	/**
	 * 用户与医生绑定关系
	 * 
	 * @author 2i
	 * @since 2015/09/03
	 * @param doctorUser
	 * @return
	 */
	int insertDoctorUser(DoctorUserEntity doctorUser);
	
	/**
	 * 查看用户与医生是否绑定
	 * 
	 * @author 2i
	 * @since 2015/09/06
	 * @param doctor_id
	 * @param user_id
	 * @return
	 */
	List<HashMap<String, Object>> selectByDoctorUserId(@Param("doctor_id") final int doctor_id,
			@Param("user_id") final int user_id);
	
	/**
	 * 通过doctor_id和user_id来更新绑定关系
	 * 
	 * @author 2i
	 * @since 2015/09/06
	 * @param doctor_id
	 * @param user_id
	 * @param user_status
	 * @return
	 */
	int updateUserStatusByDU(@Param("doctor_id") final int doctor_id,
			@Param("user_id") final int user_id,@Param("user_status") final int user_status);
}
